import {Component, ElementRef, Input, OnInit, ViewChild} from '@angular/core';
import {ObjectUtil} from '../../../../utils/object-util';

@Component({
  selector: 'dhl-titles',
  templateUrl: './dhl-titles.component.html',
})
export class DhlTitlesComponent implements OnInit {


  isShow = true;

  @Input() set show(value: boolean) {
    if (ObjectUtil.isHaveValue(value)) {
      this.isShow = value;
      $(this.tempRef.nativeElement).parent().attr('show', value + '');
      $(this.tempRef.nativeElement).parent().trigger('showTitlesEvent', {
        ele: $(this.tempRef.nativeElement),
        show: value
      });
    }
  }

  get show() {
    return this.isShow;
  }

  @ViewChild('tempRef', {static: true, read: ElementRef}) tempRef: ElementRef;

  ngOnInit() {
    $(this.tempRef.nativeElement).parent().attr('show', 'true');
  }


}
